package com.chandra.pos.customer.web;

/* @(#) CustomerReportController.java
 * Copyright 2013 - 2015 QatarAirways Group. All Rights Reserved.
 *
 * This Software is the proprietary information of QR Group
 * Use is subject to License terms.
 * Created by T4671 on 14/04/2015.
 */

import com.chandra.pos.common.web.POSController;
import com.chandra.pos.customer.dao.entity.CustomerOrderEntity;
import com.chandra.pos.customer.dao.entity.CustomerPaymentEntity;
import com.chandra.pos.customer.dao.entity.TransactionEntity;
import com.chandra.pos.customer.model.CustomerFilter;
import com.chandra.pos.customer.model.CustomerModel;
import com.chandra.pos.customer.model.TransactionFilter;
import com.chandra.pos.customer.model.TransactionList;
import com.chandra.pos.customer.service.CustomerManager;
import com.chandra.pos.customer.service.TransactionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("customer")
public class CustomerReportController extends POSController {

    private static final String PAGE_TRANSACTIONS = "transactions";
    private Logger logger = LoggerFactory.getLogger(CustomerController.class);

    @Autowired
    private CustomerManager customerManager;

    @Autowired
    private TransactionManager transactionManager;


    private static String PAGE_MODULE = "customer";



    @RequestMapping(value = "/transactionHistory", method = RequestMethod.GET)
    public
    @ResponseBody
    TransactionList transactionHistory(TransactionFilter transactionFilter) {

        return transactionManager.getTransactionHistory(transactionFilter);

    }

    @RequestMapping(value = "/transactions", method = RequestMethod.GET)
    public String transactions(TransactionFilter transactionFilter) {

        return getPageView(PAGE_MODULE, PAGE_TRANSACTIONS);

    }


    @RequestMapping(value = "/ledger", method = RequestMethod.GET)
    public String ledger(CustomerModel model) {

        return getPageView(PAGE_MODULE, PAGE_HOME);

    }


}
